﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace l1cs.server.datatables
{
    public class LogEnchantTable
    {
        private static Logger _log = Logger.getLogger( typeof( LogEnchantTable ).FullName );

        /// <summary>
        /// 強化ログを保存する。
        /// </summary>
        /// <param name="char_id">プレイヤーID</param>
        /// <param name="item_id">アイテムID</param>
        /// <param name="old_enchantlvl">強化前の強化数</param>
        /// <param name="new_enchantlvl">強化後の強化数</param>
        public static void storeLogEnchant( int char_id, int item_id, int old_enchantlvl, int new_enchantlvl )
        {/*TTOK*/
            String sqlstr = @"INSERT INTO log_enchant SET 
                                char_id        = ?1, 
                                item_id        = ?2, 
                                old_enchantlvl = ?3, 
                                new_enchantlvl = ?4";
            using ( MySqlWrapper wrapper = new MySqlWrapper() )
            {
                MySqlCommand cmd = new MySqlCommand( sqlstr );
                cmd.Parameters.Add( "?1", MySqlDbType.Int32 ).Value = char_id;
                cmd.Parameters.Add( "?2", MySqlDbType.Int32 ).Value = item_id;
                cmd.Parameters.Add( "?3", MySqlDbType.Int32 ).Value = old_enchantlvl;
                cmd.Parameters.Add( "?4", MySqlDbType.Int32 ).Value = new_enchantlvl;
                wrapper.ExecNonQuery( cmd );
            }
        }
    }
}
